<div align="center" class="easyui-validatebox">
	<form id="admin_WeikeypointAdd_Form" method="post">
		<table class="tableForm"><input name="id" type="hidden"/>
			<tr>
				<th>父级分类</th>
				<td><input name="pid" class="easyui-combotree" data-options="url:APP+'/Weikeypoint/view',parentField : 'pid',lines : true,panelWidth:250,panelHeight:400"/>
				</td>
			</tr>
			<tr>
				<th>名称</th>
				<td><input name="title" class="easyui-validatebox" data-options="required:true" style="width:200px"/>
				</td>
			</tr>
			<tr>
				<th>排序</th>
				<td><input name="sort" class="easyui-numberbox" data-options="required:true" style="width:200px"/>
    			</td>
			</tr>
			<tr>
				<th>图标500*300</th>
				<td><img id="imgShow" src="" width="150" height="150"/>
					    <input id="icon" type="hidden" name="icon"/>
					    <input id="fileToUpload" type="file" size="20" name="fileToUpload" class="input"><br>
    					<button onclick="return fileupload();">上传</button>
				</td>
			</tr>
			<tr>
				<th>点击量</th>
				<td><input name="click" class="easyui-numberbox" data-options="required:true" style="width:200px"/>
    			</td>
			</tr>
			<tr>
				<th>备注</th>
				<td colspan="3"><textarea name="remark" style="width:600px;height:150px;"></textarea>
				</td>
			</tr>
		</table>
	</form>
</div>
<script>
function fileupload(){
	if ($("#fileToUpload").val().length <= 0) {
        showMsg("请选择图片!!");
        return false;
    }else {
    	var imgurl=$("#icon").val();
		$.ajaxFileUpload({
	        url:APP+'/Public/uploadfile',
	        secureuri :false,
	        fileElementId :'fileToUpload',//file控件id
	        data:{type:'Weikeypoint',imgurl:imgurl},//一同上传的数据  
	        dataType : 'json',
	        success : function (data, status){
	            if(typeof(data) != 'undefined'){
	                if(data.error == 1){
	                	$("#icon").val(data.imgurl);
	                    $("#imgShow").attr('src',ROOT+'/Weixin/Tpl/Res/upload/Weikeypoint/'+data.imgurl); 
	                }else{
	                    showMsg(data.msg);
	                }
	            }else{
	            	showMsg("服务器出错，没有返回任何数据！");
					return false;
	            }
	        },
	        error: function(data, status, e){
	        	showMsg(data.msg);
				return false;
	        }
		});
	}
	return false;
}
</script>